Skip to content
This repository was archived by the owner on Jun 27, 2018. It is now read-only.

Add custom sg as an input to RDS#68

Open
lukaspour wants to merge 5 commits intoTeliaSoneraNorge:masterfrom
lukaspour:rds_sg_input_parameter
Open

Add custom sg as an input to RDS#68
lukaspour wants to merge 5 commits intoTeliaSoneraNorge:masterfrom
lukaspour:rds_sg_input_parameter

Conversation

@lukaspour
Copy link
Contributor

I guess this is what you meant in comments of this closed PR.

@lukaspour lukaspour requested a review from antonbabenko June 5, 2018 15:16
Copy link
Contributor

@antonbabenko antonbabenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly correct, few naming corrections.

ingress_rules = ["${var.ingress_rule}"]
}

module "custom_security_group" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace ecs in all arguments to this module with something like custom.

Word "custom" is more suitable for this module.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All ecs references got removed

ingress_with_source_security_group_id = [
{
rule = "${var.ingress_rule}"
source_security_group_id = "${var.rds_sg}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rds_sg => custom_sg_id

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naming this is the biggest problem of IT, thanks!

}

locals {
security_group_id = "${coalesce(join("", module.custom_security_group.*.security_group_id), module.rds_security_group.this_security_group_id)}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I remember correctly, join("", module.custom_security_group.*.security_group_id) can be replaced with module.custom_security_group.security_group_id.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it didn't work when I was working on it as addition for the RDS module.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@antonbabenko I will test this in RDS Neo module anyway, so I can do new PR removing this if it wouldn't be necessary

}

variable "rds_sg" {
description = "RDS security group"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Custom security group id which should be allowed to have access to this RDS instance"


name = "${local.identifier}-rds-ecs"
name = "${local.identifier}-rds-custom"
description = "Security group with RDS ports open for ECS"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"ECS" => "Security group with RDS ports open for a custom security group"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I missed that one, thanks!

@lukaspour
Copy link
Contributor Author

@antonbabenko what do you think, is it better now? I guess it is strongly related to this issue #69 if I am not able to use variables like var.global_name or var.global_project, ... I can't use module in other modules, hence it is pretty much unusable.

@mikael-lindstrom
Copy link
Contributor

Might be a silly question but why not just add a new rule to the existing security group exposed through the output this_db_subnet_group_id?

@lukaspour
Copy link
Contributor Author

To be honest, I am not sure anymore, this issue is going on for month now. We went through the problems around it in this issue #41 and made a call with Anton about it. I guess we have assumed that it would be easier to use separate SG for it because of some errors I found (I can try it again). But if it would work, it would save us few lines.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants